package spring.chatroom.java_chatroom.common.utils;

import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketSession;
import spring.chatroom.java_chatroom.pojo.WebSocketAndTime;

import java.util.PriorityQueue;

@Component
public class LRUSocket {
    PriorityQueue<WebSocketAndTime> queue;
    public LRUSocket() {
        queue = new PriorityQueue<>();
    }

    public void put(WebSocketAndTime data) {
        queue.add(data);
    }

    public WebSocketAndTime peek() {
        return queue.peek();
    }

    public WebSocketAndTime poll() {
        return queue.poll();
    }
}
